<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>分类页</title>
    <link rel="stylesheet" href="./css/style.css" />
  </head>

  <body>
    <div class="fix-title">
      <div class="back">&lt;</div>
      <input type="text" placeholder="请输入关键字" />
      <div class="text">确定</div>
    </div>
    <div class="history-list">
      <h3>历史记录 <span>全部删除</span></h3>
      <ul>
        <li>记录1</li>
        <li>记录2</li>
        <li>记录3</li>
      </ul>
    </div>
    <div class="good-list">
      <ul>
        <li>
          <img
            src="http://yun.itheima.com/Upload/Images/20220627/62b924298e658.jpg"
            alt=""
          />
          <h3>商品名称</h3>
          <p>
            <span>￥200.200</span>
            <span>+</span>
          </p>
        </li>
        <li>
          <img
            src="http://yun.itheima.com/Upload/Images/20220627/62b924298e658.jpg"
            alt=""
          />
          <h3>商品名称</h3>
          <p>
            <span>￥200.200</span>
            <span>+</span>
          </p>
        </li>
        <li>
          <img
            src="http://yun.itheima.com/Upload/Images/20220627/62b924298e658.jpg"
            alt=""
          />
          <h3>商品名称</h3>
          <p>
            <span>￥200.200</span>
            <span>+</span>
          </p>
        </li>
        <li>
          <img
            src="http://yun.itheima.com/Upload/Images/20220627/62b924298e658.jpg"
            alt=""
          />
          <h3>商品名称</h3>
          <p>
            <span>￥200.200</span>
            <span>+</span>
          </p>
        </li>
        <li>
          <img
            src="http://yun.itheima.com/Upload/Images/20220627/62b924298e658.jpg"
            alt=""
          />
          <h3>商品名称</h3>
          <p>
            <span>￥200.200</span>
            <span>+</span>
          </p>
        </li>
        <li>
          <img
            src="http://yun.itheima.com/Upload/Images/20220627/62b924298e658.jpg"
            alt=""
          />
          <h3>商品名称</h3>
          <p>
            <span>￥200.200</span>
            <span>+</span>
          </p>
        </li>
      </ul>
      <div class="empty">
        <span>空空如也...</span>
      </div>
      <p class="desc">数据正在加载中...</p>
      <p class="desc">我也是有底线的...</p>
    </div>
    <script src="../jquery.min.js"></script>
    <script src="../baseApi.js"></script>
    <script src="./js/search.js"></script>
    <!-- <script>
      let title = "";
      let ul = document.querySelector(".good-list ul");
      //封装渲染函数
      function render(title) {
        $.ajax({
          method: "get",
          data: {
            title,
          },
          url: "http://124.223.14.236:3001/api/goods",
          success(res) {
            console.log(res);
            let arr = res.data.list.map(function (item) {
              return `<li>
              <img src="${item.img}" alt="" />
              <h3>${item.title}</h3>
              <p>
                <span>${item.price}</span>
                <span>+</span>
              </p>
            </li>`;
            });
            ul.innerHTML = arr.join("");
          },
        });
      }
      render(title);

      let arr1 = [];
      $("input").on("keyup", function (e) {
        if (e.key === "Enter") {
          if (!$(this).val().trim()) {
            return alert("请输入内容");
          } else {
            arr1.push($(this).val());
            render($(this).val());
            let str3 = arr1.map(function (item) {
              return `<li>${item}</li>`;
            });
            $(".history-list ul").html(str3.join(""));
          }
        }
      });
      $("h3 span").click(function () {
        $(".history-list ul").html("");
      });
    </script> -->
  </body>
</html>
